import 'package:flutter/material.dart';
import 'package:flutter_saixiaoli/routes.dart';

class ScoreQueryList extends StatefulWidget {
  @override
  State<ScoreQueryList> createState() => _ScoreQueryListState();
}

itemWidget(context) {
  return Container(
    margin: EdgeInsets.only(bottom: 15),
    padding: EdgeInsets.only(bottom: 15),
    decoration: BoxDecoration(
        border: Border(
            bottom: BorderSide(color: Color.fromRGBO(238, 238, 238, 1)))),
    child: Row(
      children: [
        Container(
          width: 70,
          height: 70,
          margin: EdgeInsets.only(right: 15),
          decoration: BoxDecoration(
              color: Colors.grey, borderRadius: BorderRadius.circular(5)),
        ),
        Container(
          height: 70,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Container(
                child: Text(
                  '2020年第四届乐跑梁王山越野赛',
                ),
              ),
              Row(
                children: [
                  Container(
                    child: Icon(Icons.timer,
                        size: 20, color: Color.fromRGBO(153, 153, 153, 1)),
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 5),
                    child: Text(
                      '2020-11-06',
                      style: TextStyle(
                          fontSize: 13,
                          color: Color.fromRGBO(153, 153, 153, 1)),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 10),
                    child: Icon(Icons.place,
                        size: 20, color: Color.fromRGBO(153, 153, 153, 1)),
                  ),
                  Container(
                    margin: EdgeInsets.only(left: 5),
                    child: Text(
                      '宿州',
                      style: TextStyle(
                          color: Color.fromRGBO(153, 153, 153, 1),
                          fontSize: 12),
                    ),
                  )
                ],
              ),
              Row(
                children: [
                  Container(
                    margin: EdgeInsets.only(right: 5),
                    height: 16,
                    child: ElevatedButton(
                      style: ButtonStyle(
                          shape: MaterialStateProperty.all(
                              RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(8))),
                          backgroundColor: MaterialStateProperty.all(
                              Color.fromRGBO(234, 240, 255, 1))),
                      onPressed: () {
                        Navigator.pushNamed(context, Routes.scoreQuery);
                      },
                      child: Text(
                        '成绩',
                        style: TextStyle(
                            fontSize: 10,
                            color: Color.fromRGBO(48, 112, 255, 1)),
                      ),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(right: 5),
                    height: 16,
                    child: ElevatedButton(
                      style: ButtonStyle(
                          shape: MaterialStateProperty.all(
                              RoundedRectangleBorder(
                                  borderRadius: BorderRadius.circular(8))),
                          backgroundColor: MaterialStateProperty.all(
                              Color.fromRGBO(234, 240, 255, 1))),
                      onPressed: () {
                        Navigator.pushNamed(context, Routes.certificateQuery);
                      },
                      child: Text(
                        '证书',
                        style: TextStyle(
                            fontSize: 10,
                            color: Color.fromRGBO(48, 112, 255, 1)),
                      ),
                    ),
                  ),
                ],
              )
            ],
          ),
        )
      ],
    ),
  );
}

class _ScoreQueryListState extends State<ScoreQueryList> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('成绩查询'),
        elevation: 0,
        centerTitle: true,
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: EdgeInsets.all(12),
          child: Column(
            children: [itemWidget(context)],
          ),
        ),
      ),
    );
  }
}
